package vy.org.app.page.lookup.qualification;

import org.vy.dal.dao.lookup.VyLookupQualificationDO;

import vy.org.util.DateUtil;

public class MntnQualificationAssembler {

	private static MntnQualificationAssembler assembler = new MntnQualificationAssembler();

	public static MntnQualificationAssembler getAssembler() {
		return assembler;
	}

	public VyLookupQualificationDO getLookupQualificationDO(
			MntnQualificationForm form) {
		VyLookupQualificationDO dto = new VyLookupQualificationDO();
		if (form.getQualificationCode() != null
				&& !"".equals(form.getQualificationCode().trim())) {

			dto.setQualificationCode(form.getQualificationCode());
		}
		if (form.getQualificationName() != null
				&& !"".equals(form.getQualificationName().trim())) {

			dto.setQualificationName(form.getQualificationName());
		}
		if (form.getIsActive() != null && !"".equals(form.getIsActive().trim())) {

			dto.setIsActive(Boolean.parseBoolean(form.getIsActive()));
		}
		if (form.getLastUpdatedBy() != null
				&& !"".equals(form.getLastUpdatedBy().trim())) {

			dto.setLastUpdtBy(form.getLastUpdatedBy());
		}
		if (form.getLastUpdatedOn() != null
				&& !"".equals(form.getLastUpdatedOn().trim())) {

			dto.setLastUpdtOn(DateUtil.standardDate(form.getLastUpdatedOn()));
		}
		return dto;
	}

}